# -*- coding: utf-8 -*-
# @Time : 2023/9/28 10:01
# @Author : ZH
# @File : 2251.py
# @Software: PyCharm
from typing import List

class Solution:
    def fullBloomFlowers(self, flowers: List[List[int]], people: List[int]) -> List[int]:
        d_ = {}
        for i in flowers:
            if d_.get(i[0]) == None:
                d_[i[0]] = 0
            if d_.get(i[1]+1) == None:
                d_[i[1]+1] = 0
            d_[i[0]] += 1
            d_[i[1]+1] -= 1
        d_ = dict(sorted(d_.items(), key=lambda x: x[0]))
        ne = []
        for p in people:
            n = 0
            for k,v in d_.items():
               if k > p:
                    break
               else:
                   n = v
            ne.append(n)
        return ne


if __name__ == '__main__':
    so = Solution()
    fl = [[1,10],[3,3]]
    z = so.fullBloomFlowers(flowers = fl, people = [3,3,2])
    print(z)

